<?php

require_once 'tables.php';
return array(
    'basePath' => dirname(__FILE__) . DIRECTORY_SEPARATOR . '..',
    'name' => 'Previews',
    'theme' => 'light',
    'preload' => array('log'),
    'modules' => array('admin' => array(
	    'defaultController' => 'review',
	    'layout' => 'layout'
    )),
    'import' => array(
	'application.models.*',
	'application.models.ar.*',
	'application.models.managers.*',
	'application.models.services.*',
	'application.models.mappers.*',
	'application.components.*',
	'application.components.behavior.*',
	'application.components.managers.*',
	'application.components.cacheslots.*',
	'application.components.cacheslots.review.*',
	'application.components.cacheslots.opinion.*',
	'application.components.cacheslots.category.*',
	'application.components.cacheslots.company.*',
	'application.components.cacheslots.activity.*',
	'application.components.cacheslots.wishes.*',
	'application.components.cacheslots.user.*',
	'application.components.cacheslots.comment.*',
	'application.components.cacheslots.seo.*',
	'application.helpers.*',
	'application.widgets.*',
	'ext.eoauth.*',
	'ext.eoauth.lib.*',
	'ext.lightopenid.*',
	'ext.eauth.*',
	'ext.eauth.services.*',
    ),
    'defaultController' => 'review',
    'components' => array(
	'mailer' => array(
	    'class' => 'application.extensions.mailer.EMailer'
	),
	'minify' => array(
	    'class' => 'ext.minify.Minify'
	),
	'loid' => array(
	    'class' => 'ext.lightopenid.loid',
	),
	'eauth' => array(
	    'class' => 'ext.eauth.EAuth',
	    'popup' => true,
	    'services' => array(
		'google' => array(
		    'class' => 'GoogleOpenIDService',
		),
		'yandex' => array(
		    'class' => 'YandexOpenIDService',
		),
		'twitter' => array(
		    // регистрация приложения: https://dev.twitter.com/apps/new
		    'class' => 'TwitterOAuthService',
		    'key' => '...',
		    'secret' => '...',
		),
		'facebook' => array(
		    // регистрация приложения: https://developers.facebook.com/apps/
		    'class' => 'FacebookOAuthService',
		    'client_id' => '...',
		    'client_secret' => '...',
		),
		'vkontakte' => array(
		    // регистрация приложения: http://vkontakte.ru/editapp?act=create&site=1
		    'class' => 'VKontakteOAuthService',
		    'client_id' => '...',
		    'client_secret' => '...',
		)
	    ),
	),
	'user' => array(
	    'class' => 'WebUser',
	    'allowAutoLogin' => true,
	    'loginUrl' => array('/auth/login')
	),
	'authManager' => array(
	    'class' => 'PhpAuthManager',
	    'defaultRoles' => array('guest')
	),
	'cache' => array(
	    'class' => 'system.caching.CFileCache'
	),
	'image' => array(
	    'class' => 'application.extensions.image.CImageComponent',
	    'driver' => 'GD'
	),
	'memcache' => array(
	    //'class' => 'system.caching.CMemCache',
	    'class' => 'system.caching.CFileCache',
	    'behaviors' => array(
		'tags' => array(
		    'class' => 'application.components.behavior.TaggingBehavior'
		)
	    ),
//	    'servers' => array(
//		array(
//		    'host' => 'localhost',
//		    'port' => 11211,
//		    'weight' => 100
//		)
//	    )
	),
	'db' => array(
	    'class' => 'CDbConnection',
	    'connectionString' => 'mysql:host=localhost;dbname=review',
	    'emulatePrepare' => true,
	    'schemaCachingDuration' => 60*60*24*30,
	    'username' => 'root',
	    'password' => '',
	    'charset' => 'utf8',
	    //'enableProfiling' => true,
	    //'enableParamLogging' => true,
	),
	'errorHandler' => array(
	    'errorAction' => 'error/error',
	),
	'urlManager' => array(
	    'urlFormat' => 'path',
	    'rules' => array(
		'/' => 'review/index',
		'review/list/page/<page:\d+>' => 'review/list',
		'review/list' => 'review/list',
		'review/<id:\d+>/<url:[a-z-_0-9]+>.html' => 'review/view',
		'opinion/<type:(positive|negative)>/page/<page:\d+>' => 'opinion/list',
		'opinion/<type:(positive|negative)>' => 'opinion/list',
		'<_c:(review|opinion)>/edit/<id:\d+>' => '<_c>/edit',
		'categories' => 'category/index',
		'category/<name:[a-z-_0-9]+>/page/<page:\d+>' => 'category/view',
		'category/<name:[a-z-_0-9]+>' => 'category/view',
		'register' => 'auth/register',
		'profile/<id:\d+>' => 'profile/view',
		'profile/<type:(review|opinion|company|comment)>/page/<page:\d+>' => 'profile/list',
		'profile/<type:(review|opinion|company|comment)>' => 'profile/list',
		'company/add' => 'company/add',
		'company/<id:\d+>/<url:[a-z-_0-9]+>' => 'company/view',
		'company/edit/<id:\d+>' => 'company/edit',
		'company/list/page/<page:\d+>' => 'company/list',
		'company/list/<order:(rating)>/page/<page:\d+>' => 'company/list',
		'company/list/<order:(rating)>' => 'company/list',
		'auth/recover/<code:[a-z0-9]*>' => 'auth/recoverpassword',
	    ),
	    'showScriptName' => false
	),
	'clientScript' => array(
	    'scriptMap' => array(
		'jquery.min.js' => false,
		'jquery.js' => false,
	    )
	),
	'log' => array(
	    'class' => 'CLogRouter',
	    'routes' => array(
		array(
		    'class' => 'CEmailLogRoute',
		    'levels' => CLogger::LEVEL_ERROR,
		    'emails' => array('michaelnazaruk@gmail.com'),
		    'sentFrom' => 'logger@lifecoder.net',
		    'subject' => 'Error at lifecoder.net'
		),
//		array(
//		    'class' => 'ext.yii-debug-toolbar.YiiDebugToolbarRoute',
//		),
	    ),
	),
    ),
    'params' => require(dirname(__FILE__) . '/params.php'),
);